<template>
  <div class="main_box" style="padding:10px">
    <el-card class="add-wrapper">
      <el-tabs v-model="module">
        <el-tab-pane label="提现设置" name="first">
          <el-form
            :model="dataForm.cashInfo"
            ref="dataForm"
            :rules="roleRules"
            class="el-form__one"
            label-width="130px"
          >
            <el-form-item label="提现方式" prop="cashType">
              <el-radio v-model="dataForm.cashInfo.cashType" :label="1"
                >提现至自有账户</el-radio
              >
              <el-radio v-model="dataForm.cashInfo.cashType" :label="2"
                >提现至上级账户</el-radio
              >
            </el-form-item>
            <!-- <el-form-item label="结算方式" prop="settleType">
                <el-radio v-model="dataForm.cashInfo.settleType" :label="1"
                  >每日结算</el-radio
                >
                <el-radio v-model="dataForm.cashInfo.settleType" :label="2"
                  >每月结算</el-radio
                >
              </el-form-item>
              <el-form-item
                label="结算日"
                prop="settleDay"
                v-show="dataForm.cashInfo.settleType == 2"
              >
                <el-input
                  v-maxnum="{
                    obj: dataForm.cashInfo,
                    key: 'settleDay',
                    int: true,
                    max: 28
                  }"
                  placeholder="取值1~28"
                  v-model="dataForm.cashInfo.settleDay"
                >
                  <span slot="suffix">号</span>
                </el-input>
              </el-form-item>
              <el-form-item label="提现天数" prop="cashDay">
                <div class="flex" style="display:flex">
                  <div>
                    T+
                  </div>
                  <el-input
                    class="flex-input"
                    v-model="dataForm.cashInfo.cashDay"
                    @input="handleInput('cashDay')"
                  >
                  </el-input>
                  <div>
                    天
                  </div>
                </div>
              </el-form-item> -->
          </el-form>
          <div class="btn-wrapper">
            <el-button plain type="primary" @click="saveCashInfo"
              >保 存</el-button
            >
            <el-button
              type="primary"
              plain
              @click="handleNextOperate('second')"
            >
              下一步
            </el-button>
            <el-button plain @click="returnList">取 消</el-button>
          </div>
        </el-tab-pane>
        <el-tab-pane label="实名认证" name="second">
          <el-form
            :model="dataForm.qualityInfo"
            ref="dataForm2"
            :rules="roleRules2"
            class="el-form__two"
            label-width="130px"
          >
            <el-row>
              <el-form-item label="真实姓名" prop="fullName">
                <el-input v-model="dataForm.qualityInfo.fullName"></el-input>
              </el-form-item>
              <el-form-item label="手机号" prop="phone">
                <el-input
                  v-model="dataForm.qualityInfo.phone"
                  type="number"
                  v-maxnum="{
                    obj: dataForm.qualityInfo,
                    key: 'phone',
                    zero: true,
                    int: true
                  }"
                ></el-input>
              </el-form-item>
              <el-form-item label="身份证号" prop="idCard">
                <el-input v-model="dataForm.qualityInfo.idCard"></el-input>
              </el-form-item>
            </el-row>
            <el-row>
              <el-form-item prop="idCardFront" label="身份证正面照:">
                <upload-img
                  class="upload-img"
                  @uploadFileList="getImgUrl"
                  :param="{ type: 1 }"
                  folder="user/account/img"
                >
                  <img
                    v-if="dataForm.qualityInfo.idCardFront"
                    width="100%"
                    :src="dataForm.qualityInfo.idCardFront"
                    alt=""
                  />
                  <div class="tip" v-if="!dataForm.qualityInfo.idCardFront">
                    <i class="el-icon-upload"></i>
                    <div class="el-upload__text">
                      将图片拖到此处，或<em>点击上传</em>
                    </div>
                  </div>
                </upload-img>
              </el-form-item>
              <el-form-item prop="idCardBack" label="身份证反面照:">
                <upload-img
                  class="upload-img"
                  @uploadFileList="getImgUrl"
                  :param="{ type: 2 }"
                  folder="user/account/img"
                >
                  <img
                    v-if="dataForm.qualityInfo.idCardBack"
                    width="100%"
                    :src="dataForm.qualityInfo.idCardBack"
                    alt=""
                  />
                  <div class="tip" v-if="!dataForm.qualityInfo.idCardBack">
                    <i class="el-icon-upload"></i>
                    <div class="el-upload__text">
                      将图片拖到此处，或<em>点击上传</em>
                    </div>
                  </div>
                </upload-img>
              </el-form-item>
            </el-row>
          </el-form>
          <div class="btn-wrapper">
            <el-button plain type="primary" @click="saveQualityInfo"
              >保 存</el-button
            >
            <el-button type="primary" plain @click="handleNextOperate('first')">
              上一步
            </el-button>
            <el-button type="primary" plain @click="handleNextOperate('third')">
              下一步
            </el-button>
            <el-button plain @click="returnList">取 消</el-button>
          </div>
        </el-tab-pane>
        <el-tab-pane label="收款账户" name="third">
          <el-form
            :model="dataForm.accountInfo"
            :rules="roleRules3"
            ref="dataForm3"
            label-width="160px"
            class="el-form__two"
          >
            <el-row>
              <el-form-item label="真实姓名" prop="fullName">
                <el-input v-model="dataForm.accountInfo.fullName"></el-input>
              </el-form-item>
              <el-form-item label="手机号" prop="phone">
                <el-input
                type="number"
                  v-model="dataForm.accountInfo.phone"
                  :readonly="dataForm.accountInfo.ymAccountId ? true : false"
                  v-maxnum="{
                    obj: dataForm.accountInfo,
                    key: 'phone',
                    zero: true,
                    int: true
                  }"
                >
                  <el-button
                    v-if="!dataForm.accountInfo.ymAccountId"
                    type="success"
                    slot="append"
                    @click="getYmAccountInfo()"
                  >
                    获取信息
                  </el-button>
                </el-input>
              </el-form-item>
              <el-form-item label="身份证号" prop="idCard">
                <el-input v-model="dataForm.accountInfo.idCard"></el-input>
              </el-form-item>
              <el-form-item label="持卡人姓名" prop="cardName">
                <el-input v-model="dataForm.accountInfo.cardName"> </el-input>
              </el-form-item>
              <el-form-item label="银行" prop="bankCode">
                <el-select
                  v-model="dataForm.accountInfo.bankCode"
                  clearable
                  filterable
                  @change="handleBankChange()"
                >
                  <el-option
                    v-for="item in bankList"
                    :value="item.bankCode"
                    :label="item.bankName"
                    :key="item.code"
                  ></el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="银行支行" prop="branchCode">
                <el-input
                  v-model="dataForm.accountInfo.branchName"
                  clearable
                  readonly
                  @focus="getBranchBankList()"
                  placeholder="选择银行支行"
                ></el-input>
              </el-form-item>
              <el-form-item label="银行卡号" prop="cardNo">
                <el-input
                  v-model="dataForm.accountInfo.cardNo"
                  v-maxnum="{
                    obj: dataForm.accountInfo,
                    key: 'cardNo',
                    zero: true,
                    int: true
                  }"
                >
                </el-input>
              </el-form-item>

              <!-- <el-form-item label="设为结算账户" prop="defaultFlag">
                <el-radio-group
                  v-model="dataForm.accountInfo.defaultFlag"
                  :disabled="dataForm.accountInfo.ymAccountId ? true : false"
                >
                  <el-radio :label="0">
                    否
                  </el-radio>
                  <el-radio :label="1">
                    是
                  </el-radio>
                </el-radio-group>
              </el-form-item> -->
              <el-form-item
                label="开通状态"
                v-if="dataForm.accountInfo.ymAccountId"
              >
                <el-tag
                  size="samll"
                  effect="dark"
                  :type="formatOpenStates(dataForm.accountInfo.openState)"
                >
                  {{ formatOpenState(dataForm.accountInfo.openState) }}
                </el-tag>
              </el-form-item>
              <el-form-item
                label="启用状态"
                v-if="dataForm.accountInfo.ymAccountId"
              >
                <el-tag
                  size="samll"
                  effect="dark"
                  :type="dataForm.accountInfo.relationState ? '' : 'danger'"
                >
                  {{ dataForm.accountInfo.relationState ? "启用" : "禁用" }}
                </el-tag>
              </el-form-item>
            </el-row>
            <el-row>
              <el-form-item prop="idCardFront" label="身份证正面照:">
                <upload-img
                  class="upload-img"
                  @uploadFileList="getImgUrl"
                  :param="{ type: 3 }"
                  folder="user/account/img"
                >
                  <img
                    v-if="dataForm.accountInfo.idCardFront"
                    width="100%"
                    :src="dataForm.accountInfo.idCardFront"
                    alt=""
                  />
                  <div class="tip" v-if="!dataForm.accountInfo.idCardFront">
                    <i class="el-icon-upload"></i>
                    <div class="el-upload__text">
                      将图片拖到此处，或<em>点击上传</em>
                    </div>
                  </div>
                </upload-img>
              </el-form-item>
              <el-form-item prop="idCardBack" label="身份证反面照:">
                <upload-img
                  class="upload-img"
                  @uploadFileList="getImgUrl"
                  :param="{ type: 4 }"
                  folder="user/account/img"
                >
                  <img
                    v-if="dataForm.accountInfo.idCardBack"
                    width="100%"
                    :src="dataForm.accountInfo.idCardBack"
                    alt=""
                  />
                  <div class="tip" v-if="!dataForm.accountInfo.idCardBack">
                    <i class="el-icon-upload"></i>
                    <div class="el-upload__text">
                      将图片拖到此处，或<em>点击上传</em>
                    </div>
                  </div>
                </upload-img>
              </el-form-item>
              <el-form-item label="银行卡正面照:" prop="bankCardFront">
                <upload-img
                  class="upload-img"
                  @uploadFileList="getImgUrl"
                  :param="{ type: 5 }"
                  folder="user/account/img"
                >
                  <img
                    v-if="dataForm.accountInfo.bankCardFront"
                    width="100%"
                    :src="dataForm.accountInfo.bankCardFront"
                    alt=""
                  />
                  <div class="tip" v-if="!dataForm.accountInfo.bankCardFront">
                    <i class="el-icon-upload"></i>
                    <div class="el-upload__text">
                      将图片拖到此处，或<em>点击上传</em>
                    </div>
                  </div>
                </upload-img>
              </el-form-item>
              <el-form-item label="银行卡反面照:" prop="bankCardBack">
                <upload-img
                  class="upload-img"
                  @uploadFileList="getImgUrl"
                  :param="{ type: 6 }"
                  folder="user/account/img"
                >
                  <img
                    v-if="dataForm.accountInfo.bankCardBack"
                    width="100%"
                    :src="dataForm.accountInfo.bankCardBack"
                    alt=""
                  />
                  <div class="tip" v-if="!dataForm.accountInfo.bankCardBack">
                    <i class="el-icon-upload"></i>
                    <div class="el-upload__text">
                      将图片拖到此处，或<em>点击上传</em>
                    </div>
                  </div>
                </upload-img>
              </el-form-item>
            </el-row>
          </el-form>
          <div class="btn-wrapper" size="small">
            <el-button plain type="primary" @click="saveAccountInfo">
              保 存
            </el-button>
            <el-button
              type="primary"
              plain
              @click="handleNextOperate('second')"
            >
              上一步
            </el-button>
            <el-button plain @click="returnList">取 消</el-button>
          </div>
        </el-tab-pane>
      </el-tabs>
    </el-card>
    <el-dialog
      title="银行支行"
      :visible.sync="branchBank.show"
      center
      width="fit-content"
      destory-on-close
    >
      <el-form
        class="search_wrap"
        :inline="true"
        :model="branchBank"
        ref="searchForm"
      >
        <el-form-item prop="branchName">
          <el-input
            v-model="branchBank.branchName"
            clearable
            placeholder="支行名称"
          ></el-input>
        </el-form-item>
        <el-form-item prop="branchCode">
          <el-input
            v-model="branchBank.branchCode"
            clearable
            placeholder="支行编号"
          ></el-input>
        </el-form-item>
        <el-form-item>
          <el-button
            icon="el-icon-search"
            type="primary"
            size="mini"
            @click="searchBranchList"
            >查询</el-button
          >
          <el-button icon="el-icon-refresh-left" size="mini" @click="resetForm"
            >重置</el-button
          >
        </el-form-item>
      </el-form>
      <el-table
        :data="branchBankList"
        highlight-current-row
        @current-change="handleCurrentClick"
        max-height="600"
      >
        <el-table-column type="index" label="序号" align="center" width="100">
        </el-table-column>
        <el-table-column
          prop="branchName"
          label="支行名称"
          align="center"
          width="270"
        >
        </el-table-column>
        <el-table-column
          prop="branchCode"
          label="支行编号"
          align="center"
          width="230"
        >
        </el-table-column>
      </el-table>
      <el-pagination
        background
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="page.pageNo"
        :page-sizes="[20, 50, 100]"
        :page-size="page.pageSize"
        layout="total, sizes, jumper, next, pager, prev"
        :total="page.pageTotal"
      ></el-pagination>
    </el-dialog>
  </div>
</template>

<script>
import * as message from "@/constants/message";
import BusinessApi from "@/api/business/business";
import AccountInfoApi from "@/api/account/accountInfo";
import YmAccountApi from "@/api/account/ymAccount";
import { getStorage } from "@/utils/auth";
import { USER_INFO } from "@/constants/storeName";
import UploadImg from "@/components/UploadImg";

export default {
  data() {
    return {
      module: "first",
      dataForm: {
        userId: "",
        qualityInfo: {
          accountInfoId: "",
          fullName: "",
          phone: "",
          idCard: "",
          idCardFront: "",
          idCardBack: ""
        },
        accountInfo: {
          ymAccountId:"",
          userType:3,
          fullName: "",
          phone: "",
          idCard: "",
          idCardFront: "",
          idCardBack: "",
          cardType: 2,
          cardNo: "",
          cardName:"",
          bankCode: "",
          bankName: "",
          branchName: "",
          branchCode: "",
          bankCardFront: "",
          bankCardBack: "",
          defaultFlag: 1,
          openState: "",
          relationState: ""
        },
        cashInfo: {
          // cashDay: "",
          cashType: 1
          // settleType: 1, //1.每日结算 2. 每月结算
          // settleDay: ""
        }
      },
      branchBank: {
        show: false,
        type: "",
        branchCode: "",
        branchName: ""
      },
      bank: {
        show: false,
        cardType: ""
      },
      page: {
        pageNo: 1,
        pageTotal: 0,
        pageSize: 20
      },
      bankList: [],
      branchBankList: [
        { code: 3, name: "公有支行1" },
        { code: 4, name: "公有支行2" }
      ],
      serverLevel2List: [], //服务分类二级列表
      treeTwoServerList: [], //服务分类一二级列表
      selectedServerList: [], //从serverLevel2List里面选择了服务分类之后形成新的服务分类列表
      loadingIns: false,
      roleRules: {
        cashType: [
          { required: true, message: "请选择提现方式", trigger: "change" }
        ]
        // settleType: [
        //   { required: true, message: "请选择结算方式", trigger: "change" }
        // ],
        // cashDay: [
        //   { required: true, message: "请输入提现天数", trigger: "blur" }
        // ]
      },
      roleRules2: {
        fullName: [
          { required: true, message: "请输入真实姓名", trigger: "blur" }
        ],
        phone: [
          { required: true, message: "请输入手机号", trigger: "blur" },
          {
            pattern: /(^1(3|4|5|6|7|8|9)\d{9}$)|(^0\d{2,3}-?\d{7,8}$)/,
            message: "手机号格式错误",
            trigger: "blur"
          }
        ],
        idCard: [
          { required: true, message: "请输入身份证号", trigger: "blur" },
          {
            pattern: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
            message: "身份证式错误",
            trigger: "blur"
          }
        ]
      },
      roleRules3: {
        fullName: [
          { required: true, message: "请输入真实姓名", trigger: "blur" }
        ],
        phone: [
          { required: true, message: "请输入手机号", trigger: "blur" },
          {
            pattern: /(^1(3|4|5|6|7|8|9)\d{9}$)|(^0\d{2,3}-?\d{7,8}$)/,
            message: "手机号格式错误",
            trigger: "blur"
          }
        ],
        idCard: [
          { required: true, message: "请输入身份证号", trigger: "blur" },
          {
            pattern: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
            message: "身份证式错误",
            trigger: "blur"
          }
        ],
        idCardFront: [
          { required: true, message: "请上传身份证正面照", trigger: "change" }
        ],
        cardName: [
          { required: true, message: "请填写持卡人姓名", trigger: "blur" }
        ],
        idCardBack: [
          { required: true, message: "请上传身份证反面照", trigger: "change" }
        ],
        cardNo: [{ required: true, message: "请填银行卡号", trigger: "blur" }],
        bankCode: [
          { required: true, message: "请选择银行", trigger: "change" }
        ],
        branchCode: [
          { required: true, message: "请选择银行支行", trigger: "change" }
        ],
        bankCardFront: [
          { required: true, message: "请上传银行卡正面照", trigger: "change" }
        ],
        bankCardBack: [
          { required: true, message: "请上传银行卡反面照", trigger: "change" }
        ],
        defaultFlag: [
          {
            required: true,
            message: "请选择是否设为结算账户",
            trigger: "change"
          }
        ]
      }
    };
  },
  components: {
    UploadImg
  },
  watch: {
    // "dataForm.cashInfo.settleType": {
    //   handler(val) {
    //     const { roleRules } = this;
    //     const settleDay = {
    //       required: true,
    //       message: "请输入结算日",
    //       trigger: "blur"
    //     };
    //     if (val == 2) {
    //       this.$set(roleRules, "settleDay", settleDay);
    //     } else {
    //       this.$delete(roleRules, "settleDay");
    //     }
    //     this.$nextTick(() => {
    //       if (this.$refs.dataForm) {
    //         this.$refs.dataForm.clearValidate();
    //       }
    //     });
    //   },
    //   immediate: true
    // }
  },
  mounted() {
    this.init();
  },
  methods: {
    init() {
      this.dataForm.userId = this.$route.query.id;
      this.getBankList();
      this.getData();
    },
    async getData() {
      const { userId } = this.dataForm;
      const res = await Promise.all([
        AccountInfoApi.getAccountInfo({ userId }),
        YmAccountApi.getYmAccount({ userId })
      ]);
      const quality = res[0].data;
      const account = res[1].data;
      const { cashInfo, qualityInfo, accountInfo } = this.dataForm;
      this.$Utils.bindingBean(qualityInfo, quality);
      this.$Utils.bindingBean(accountInfo, account);
      cashInfo.cashType = quality.cashType || 2;
    },
    keydown(e) {
      if (e.keyCode == 32) {
        e.returnValue = false;
      }
    },
    handleNextOperate(val) {
      this.module = val;
    },
    formatOpenStates(val) {
			switch (val) {
				case 1:
					return ""
				case 2:
					return "success"
				case 3:
					return "danger"
			}
		},
		formatOpenState(val) {
			switch (val) {
				case 1:
					return "开户审核中"
				case 2:
					return "开户成功"
				case 3:
					return "开户失败"
			}
		},
    handleInput(prop) {
      const { dataForm } = this;
      switch (prop) {
        case "cashDay":
          dataForm.cashInfo.cashDay = dataForm.cashInfo.cashDay.replace(
            /([^\d]*)|(^0$)/g,
            ""
          );
          break;
      }
    },
    // 获取商图片
    getImgUrl(val) {
      //console.log(val)
      if (val.uploadFileList.length > 0) {
        this.$Utils.notifySuccess("上传成功");
        const {
          dataForm: { accountInfo, qualityInfo }
        } = this;
        const url = val.uploadFileList[0];
        const { type, index } = val.param;
        switch (type) {
          case 1:
            qualityInfo.idCardFront = url;
            break;
          case 2:
            qualityInfo.idCardBack = url;
            break;
          case 3:
            accountInfo.idCardFront = url;
            break;
          case 4:
            accountInfo.idCardBack = url;
            break;
          case 5:
            accountInfo.bankCardFront = url;
            break;
          case 6:
            accountInfo.bankCardBack = url;
            break;
        }
      }
    },
    async getYmAccountInfo() {
      const { dataForm } = this;
      this.$refs.dataForm3.validateField("phone", async err => {
        if (!err) {
          await this.$confirm("确定获取并使用翼码信息", "提示", {});
          // 获取信息
          const params = {
            userType: 3,
            phone: dataForm.accountInfo.phone
          };
          const { data } = await YmAccountApi.getDataByNameType(params);
          if (data) {
            dataForm.accountInfo = data;
          } else {
            this.$message.error("暂无可用的翼码信息");
          }

          this.$nextTick(() => {
            this.$refs.dataForm3.clearValidate();
          });
        }
      });
    },
    // 获取银行卡列表
    getBankList() {
      BusinessApi.listBankCode().then(res => {
        this.bankList = res.data;
      });
    },
    // 银行改变
    handleBankChange() {
      const {
        bankList,
        dataForm: { accountInfo }
      } = this;
      accountInfo.branchName = "";
      accountInfo.branchCode = "";
      accountInfo.bankName = accountInfo.bankCode
        ? bankList.find(item => item.bankCode == accountInfo.bankCode).bankName
        : "";
    },
    // 点击获取银行卡支行的列表
    async getBranchBankList() {
      const {
        dataForm: {
          accountInfo: { bankCode }
        },
        branchBank,
        page
      } = this;
      const { branchCode, branchName } = branchBank;
      const { pageSize, pageNo } = page;
      if (bankCode) {
        const params = {
          pageSize,
          pageNo,
          bankCode,
          branchCode,
          branchName
        };
        const res = await BusinessApi.pageBranchCode(params);
        const { list, total } = res.data;
        this.branchBankList = list || [];
        page.pageTotal = total;
        branchBank.show = true;
      } else {
        this.$message.error("请先选择银行");
      }
    },
    searchBranchList() {
      const { page } = this;
      page.pageNo = 1;
      this.getBranchBankList();
    },
    resetForm() {
      this.$refs.searchForm.resetFields();
      this.searchBranchList()
    },
    handleSizeChange(size) {
      this.page.pageSize = size;
      this.getBranchBankList();
    },
    handleCurrentChange(val) {
      this.page.pageNo = val;
      this.getBranchBankList();
    },
    // 选中支行
    handleCurrentClick(val) {
      if (!val) return;
      const {
        dataForm: { accountInfo },
        branchBank
      } = this;
      const { branchCode, branchName } = val;
      accountInfo.branchCode = branchCode;
      accountInfo.branchName = branchName;
      branchBank.show = false;
    },
    // 账户信息保存
    async handleBusinessAccount() {
      const { accountInfo, businessId } = this.dataForm;
      await this.$refs.dataForm2.validate();
      await this.$confirm("确定保存账户信息？", "提示", {});
      const params = Object.assign({ ...accountInfo }, { businessId });
      if (params.settleType == 1) {
        delete params.settleDay;
      }
      const loading = this.$loading({
        text:"设置中",
        spinner:"el-icon-loading",
      })
      AccountInfoApi.setAccountInfo(params).then(res => {
        this.$Utils.notifySuccess("设置成功");
      });

    },
    // 提现信息保存
    async saveCashInfo() {
      const {
        qualityInfo: { accountInfoId },
        cashInfo,
        userId
      } = this.dataForm;
      await this.$refs.dataForm.validate();
      await this.$confirm("确定保存提现信息？", "提示", {});
      const params = Object.assign({ ...cashInfo }, { userId });
      if (accountInfoId) {
        params.accountInfoId = accountInfoId;
      }
      const loading = this.$loading({
        text:"设置中",
        spinner:"el-icon-loading",
      })
      AccountInfoApi.setAccountBase(params).then(res => {
        this.$Utils.notifySuccess("设置成功");
      }).finally(()=>{
        loading.close()
      })
    },
    // 实名认证保存
    async saveQualityInfo() {
      await this.$refs.dataForm2.validate();
      await this.$confirm("确定保存实名认证信息", "提示", {});
      const { qualityInfo, userId } = this.dataForm;
      const params = { ...qualityInfo, userId };
      const loading = this.$loading({
        text:"保存中",
        spinner:"el-icon-loading",
      })
      try{
        await AccountInfoApi.setAccountInfo(params);
        this.$Utils.notifySuccess("设置成功");
      }finally{
        loading.close()
      }
    },
    // 收款账户保存
    async saveAccountInfo() {
      await this.$refs.dataForm3.validate();
      await this.$confirm("确定保存收款账户", "提示", {});
      const { accountInfo, userId } = this.dataForm;
      const params = { ...accountInfo, userId };
      const loading = this.$loading({
        text:"保存中",
        spinner:"el-icon-loading",
      })
      try{
        await YmAccountApi.setYmAccount(params);
        this.$Utils.notifySuccess("设置成功");
      }finally{
        loading.close()
      }
    },
    returnList() {
      this.$store.dispatch("delView", this.$route);
      this.$router.back();
    }
  }
};
</script>
<style lang="scss" scoped>
@import "@/assets/css/views/add.scss";
</style>
<style lang="scss" scoped>
@import "@/assets/css/views/addType.scss";
</style>
<style lang="scss" scoped>
.bussiness-villgae-header {
  padding: 4px 0;
  font-size: 14px;
  color: #1e6abc;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.upload-img {
  &::v-deep .el-upload {
    width: 100%;

    .el-upload-dragger {
      width: 100%;
      display: flex;
      justify-content: space-around;
      align-items: center;

      .tip {
        padding-bottom: 30px;
      }
    }
  }
}

.flex {
  // width: 300px;
  .flex-input {
    // width:240px;
    margin: 0 10px !important;

    &::v-deep .el-input__inner {
      width: 100% !important;
    }
  }
}
</style>
